/**
 * 统一导出所有类型定义
 */

export * from './auth'
export * from './chat'

// 通用类型定义
export interface PageMeta {
  current: number
  size: number
  total: number
  pages: number
}

export interface PageResult<T> {
  records: T[]
  meta: PageMeta
}

export interface SelectOption {
  label: string
  value: string | number
  disabled?: boolean
}

export interface MenuItem {
  id: string
  label: string
  icon?: string
  path?: string
  children?: MenuItem[]
}

// 组件 Props 类型
export interface BaseComponentProps {
  class?: string
  style?: string | Record<string, any>
}

// 事件处理函数类型
export type EventHandler<T = Event> = (event: T) => void
export type AsyncEventHandler<T = Event> = (event: T) => Promise<void>

// 工具类型
export type Nullable<T> = T | null
export type Optional<T> = T | undefined
export type NonNullable<T> = T extends null | undefined ? never : T

// 深度只读类型
export type DeepReadonly<T> = {
  readonly [P in keyof T]: T[P] extends object ? DeepReadonly<T[P]> : T[P]
}

// 部分必需类型
export type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>
export type RequiredBy<T, K extends keyof T> = Omit<T, K> & Required<Pick<T, K>>
